package net.minecraft.src;

import java.io.*;

public class LF_EntitySeatBackup extends Entity {
	
	LF_BlockSeat blockObj;
	boolean isFirstUpdate = true;
	int x, y, z;
	float yHeight;
	float firstYaw;

	public LF_EntitySeatBackup(World world)
	{
		super(world);
	}

	public LF_EntitySeatBackup(World world, int i, int j, int k, Entity ent, LF_BlockSeat obj1)
	{
		super(world);
		motionX = 0;
		motionY = 0;
		motionZ = 0;
		x = i;
		y = j;
		z = k;
		setPosition(i + 0.5D,j,k + 0.5D);
		prevPosX = posX;
		prevPosY = posY;
		prevPosZ = posZ;
		blockObj = obj1;
		yHeight = obj1.getSeatHeight();
		rotationYaw = getRotationFromMeta();
		setSize(0,0);
	}

	@Override
	public double getMountedYOffset()
	{
		return yHeight;
	}

	@Override
	public void setPosition(double d, double d1, double d2)
	{
		super.setPosition(x + 0.5D, y, z + 0.5D);
	}

	public float getRotationFromMeta()
	{
		int m = worldObj.getBlockMetadata(x, y, z);
		if(m == 0)
			return 270;
		if(m == 1)
			return 90;
		if(m == 2)
			return 0;
		if(m == 3)
			return 180;

		return 0;
	}

	@Override
	public void onEntityUpdate()
	{
		int blockId = worldObj.getBlockId(x,y,z);

		if(riddenByEntity == null)
			kill();
		else
			if(!(Block.blocksList[blockId] instanceof LF_BlockSeat)) riddenByEntity.mountEntity(null);
	}

	@Override
	protected void entityInit()
	{
	}

	@Override
	public void writeEntityToNBT(NBTTagCompound nbttagcompound)
	{
	}

	@Override
	public void readEntityFromNBT(NBTTagCompound nbttagcompound)
	{
	}
}
